﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using PwdMgr.PwdMgrService.Sessions;
using PwdMgr.Utility;
using PwdMgr.Utility.Exceptions;
using PwdMgr.DataAccess;

namespace PwdMgr.PwdMgrService.DataService
{
    public class DataService : IDataService
    {
        public IDataAccessManager DataAccessMgr { get; set; }
        public void CreateSensitiveInfo(CommonContract.SensitiveInfo info)
        {
            using (IDataAccess access = DataAccessMgr.CreateInstance(true))
            {
                access.CreateSensitiveInfo(info);
            }
        }

        public List<CommonContract.SensitiveInfo> GetSensitiveInfo(string tag, int uid)
        {
            using (var access = DataAccessMgr.CreateInstance(true))
            {
                return access.GetSensitiveInfo(tag, uid);
            }
        }

        public void DeleteSensitiveInfo(int id)
        {
            using (var access = DataAccessMgr.CreateInstance(true))
            {
                access.DeleteSensitiveInfo(id);
            }
        }
    }
}
